<?php 
require '../../frame/base.php';

$sid = !empty($_REQUEST['sid']) ? $_REQUEST['sid'] : null;
$uid = !empty($_REQUEST['uid']) ? $_REQUEST['uid'] : null;

// $uid = '2609';
class MyPrizeBean
{
	public $content;

	function __construct($content)
	{
		$this->content = $content;
	}
}

$resultData['bankInfo'] = $Db->table('banks')->field('id,bank_name')->select();
if($uid){
	$resultData['money'] = $Db->table('user')->field('money')->where('userid',$uid)->find();
	
	if( $Db->table('blind_wei')->where(['uid'=>$uid])->find() ){
		$resultData['wei']=$Db->table('blind_wei')->field('id,weipay,weixin_name,realname,telphone')->where('uid',$uid)->select();
	}
	if( $Db->table('blind_alipay')->where(['uid'=>$uid])->find() ){
		$resultData['alipay']=$Db->table('blind_alipay')->field('id,alipay,alipay_name,realname,telphone')->where('uid',$uid)->select();
	}
	if( $Db->table('blind_banks')->where(['uid'=>$uid])->find() ){
		$resultData['banks']=$Db->table('blind_banks')->field('id,bank_account,bid,realname,telphone')->where('uid',$uid)->select();
	}
	$row=$Db->table('user')->where('userid',$uid)->find();
	if( $row['passwd'] ){
		$resultData['passed']='yes';
	}else{
		$resultData['passed']='no';
	}
	$resultData['tixiNote'] = $Db->table('xitong')->field('id,tixiNote')->where('id',1)->select();
	$resultData['bindtel'] = $row['bindphone'];
	echo json_encode(['code'=>200,'msg'=>'成功','data'=>$resultData]);

}elseif($sid){
	$resultData['money'] = $Db->table('shop')->field('money')->where('shopid',$sid)->find();

	if( $Db->table('blind_wei')->where(['sid'=>$sid])->find() ){
		$resultData['wei']=$Db->table('blind_wei')->field('id,weipay,weixin_name,realname,telphone')->where('sid',$sid)->select();
	}
	if( $Db->table('blind_alipay')->where(['sid'=>$sid])->find() ){
		$resultData['alipay']=$Db->table('blind_alipay')->field('id,alipay,alipay_name,realname,telphone')->where('sid',$sid)->select();
	}
	if( $Db->table('blind_banks')->where(['sid'=>$sid])->find() ){
		$resultData['banks']=$Db->table('blind_banks')->field('id,bank_account,bid,realname,telphone')->where('sid',$sid)->select();
	}
	$row=$Db->table('shop')->where('shopid',$sid)->find();
	if( $Db->table('shop')->where('shopid',$sid)->find()['passwd'] ){
		$resultData['passed']='yes';
	}else{
		$resultData['passed']='no';	
	}
	$resultData['tixiNote'] = $Db->table('xitong')->field('id,tixiNote')->where('id',1)->select();
	$resultData['bindtel']=$row['bindphone'];
	
	echo json_encode(['code'=>200,'msg'=>'成功','data'=>$resultData]);
}
